<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>老人出院流转列表</title>
	<#include "/common/resource.ftl">
</head>
<body>

<div class="ui-operation">
    <div class="ui-search-items layui-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input type="text" name="elderName" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-inline">
                    <select name="status" class="layui-input">
                        <option value="">请选择</option>
                        <option value="1">出院登记</option>
                        <option value="2">医生评估通过</option>
                        <option value="3">医生评估驳回</option>
                        <option value="4">护理评估通过</option>
                        <option value="5">护理评估驳回</option>
                        <option value="6">后勤评估通过</option>
                        <option value="7">后勤评估驳回</option>
                        <option value="8">院办签订协议通过</option>
                        <option value="9">院办签订协议驳回</option>
                        <option value="10">院办存档</option>
                        <option value="11">财务结算</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="ui-buttons">
        <div class="layui-btn-group tools">
            <@auth code='outHospital_add'><button class="layui-btn layui-btn-normal open-dialog" p="url:'${params.contextPath}/view/business/outHospital/outHospital_edit.htm',title:'添加老人出院流转表',width:'800px',height:'600px'"><i class="fa fa-plus"></i>添加</button></@auth>
            <@auth code='outHospital_update'><button class="layui-btn layui-btn-normal singleSelected" p="url:'${params.contextPath}/view/business/outHospital/outHospital_edit.htm',title:'编辑老人出院流转表',width:'800px',height:'600px'"><i class="fa fa-pencil"></i>修改</button></@auth>
            <@auth code='outHospital_delete'><button class="layui-btn layui-btn-normal remove-button" reurl="${params.contextPath}/web/outHospital/delete.json"><i class="fa fa-remove"></i>删除</button></@auth>
        </div>
        <div class="ui-searchs">
            <input type="button" value="搜索" class="layui-btn layui-btn-danger search-button"/>
        </div>
    </div>
</div>
<div class="ui-content" style="padding-left: 10px;padding-right:10px;">
    <table id="datagrid" options="url:'${params.contextPath}/web/outHospital/list.json',params:'getSearchParams',dblClickRow:'showDetail'">
        <thead>
			<tr>
				<th data-options="field:'id',checkbox:true"></th>
				<th data-options="field:'elderName',align:'left'">姓名</th>
                <th data-options="field:'sex',align:'left',formatter:formatSex">性别</th>
                <th data-options="field:'birthDate',align:'left'">出生年月</th>
                <th data-options="field:'idcard',align:'left'">身份证号</th>
                <th data-options="field:'code',align:'left'">入院号</th>
                <th data-options="field:'bedNum',align:'left'">床位号</th>
                <th data-options="field:'checkInDateStr',align:'left'">入住日期</th>
                <th data-options="field:'nursingLevelStr',align:'left'">护理等级</th>
				<th data-options="field:'leaveDateStr',align:'left'">离院日期</th>
				<th data-options="field:'reason',width:150,align:'left'">离院原因</th>
                <th data-options="field:'statusStr',align:'left'">状态</th>
				<th data-options="field:'remark',width:150,align:'left'">备注</th>
			</tr>
        </thead>
    </table>
</div>
<script type="text/javascript">
    function getSearchParams() {
        return {
            elderName: $("input[name='elderName']").val(),
            status: $("select[name='status']").val()
        };
    }
    var showDetail = function (index, row) {
        <@auth code='outHospital_detail'>
            var url = "${params.contextPath}/view/business/outHospital/outHospital_detail.htm?id=" + row.id;
            DialogManager.openDialog("url:'" + url + "',title:'老人出院流转表详情',width:'90%',height:'100%'");
        </@auth>
    };

    var sexOperator = "";
    function formatSex(row) {
        if (!sexOperator) {
            sexOperator = DictionaryHelper.getDictionaryOperator("sex");
        }
        return sexOperator.getDictionaryItemName(row.sex);
    }

    //formatter:formatState
    function formatState(val, row) {
    }

    $(function () {
        $(".remove-button").click(function () {
            var ids = DataGrid.getCheckedIds();
            if (ids == "") {
                layer.msg("请选择删除记录")
                return false;
            }
            var url = $(this).attr("reurl");
            layer.confirm('确定删除记录', function () {
                $.ajaxRequest({
                    type: 'post',
                    url: url,
                    data: {ids: ids.join(",")},
                    success: function (data) {
                        $.message(data.message);
                        if (data.success) {
                            DataGrid.reload();
                        }
                    }
                });
            });
        });
    });
</script>
</body>

</html>
